package de.szut.traineeslife.adapter;

import com.viewpagerindicator.IconPagerAdapter;

import de.szut.traineeslife.R;
import de.szut.traineeslife.ui.FragmentCalendar;
import de.szut.traineeslife.ui.FragmentManagement;
import de.szut.traineeslife.ui.FragmentOverview;
import de.szut.traineeslife.ui.FragmentReport;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class PagerAdapter
    extends FragmentPagerAdapter
    implements IconPagerAdapter {

    private static final String[] PAGER_CONTENT = new String[] { "Berischte", "Überischt", "Kalendaz", "Verwalterung" };

    private static final int[] PAGER_ICONS = new int[] { R.drawable.ic_launcher, R.drawable.ic_launcher,
        R.drawable.ic_launcher, R.drawable.ic_launcher, };

    public PagerAdapter( FragmentManager fm ) {
        super( fm );
    }

    @Override
    public Fragment getItem( int position ) {
        Fragment f = new Fragment();
        f = null;
        switch ( position ) {
            case 0:
                f = new FragmentReport();
                break;
            case 1:
                f = new FragmentOverview();
                break;
            case 2:
                f = new FragmentCalendar();
                break;
            case 3:
                f = new FragmentManagement();
                break;

            default:
                break;
        }
        return f;
    }
    @Override
    public CharSequence getPageTitle(int position) {
        return PAGER_CONTENT[position % PAGER_CONTENT.length];
    }

    @Override public int getIconResId(int index) {
      return PAGER_ICONS[index];
    }

  @Override
    public int getCount() {
      return PAGER_CONTENT.length;
    }

}
